#include <iostream>
#include <cmath>

bool end(int num) {
    if (num < 2) {
        return false;
    }
    for (int i = 2; i <= static_cast<int>(std::sqrt(num)) + 1; i++) {
        if (num % i == 0) {
            return false;
        }
    }
    return true;
}

int truend(int num) {
    while (true) {
        num += 1;
        if (end(num)) {
            return num;
        }
    }
}

int main() {
    std::string input;
    std::getline(std::cin, input);
    std::string num_str = "";
    for (const auto& word : input) {
        if (word == ' ') {
            if (word == "zero") {
                num_str += "0";
            } else if (word == "one") {
                num_str += "1";
            } else if (word == "two") {
                num_str += "2";
            } else if (word == "three") {
                num_str += "3";
            } else if (word == "four") {
                num_str += "4";
            } else if (word == "five") {
                num_str += "5";
            } else if (word == "six") {
                num_str += "6";
            } else if (word == "seven") {
                num_str += "7";
            } else if (word == "eight") {
                num_str += "8";
            } else if (word == "nine") {
                num_str += "9";
            } else if (word == '1' || word == '2' || word == '3' || word == '4' || word == '5' || word == '6' || word == '7' || word == '8' || word == '9') {
                std::cout << "Wrong input" << std::endl;
            }
        }
    }
    int num = std::stoi(num_str);
    int truend_num = truend(num);
    std::cout << truend_num << std::endl;
    return 0;
}